import request from '@api/request';
import { HttpUrl } from '@api/httpUrl';
import { useUserStore } from '@/store/modules/user';

// 获取印版数据
export function getFormeList() {
    return request.get<AjaxResponse['formeList']>(HttpUrl.getFormeList);
}

// 新增印版数据
export function addForme(addFormeForm: AjaxRequest['addFormeForm']) {
    return request.post(HttpUrl.addForme, { ...addFormeForm, creator: useUserStore().username, creatorId: useUserStore().id });
}

// 更新印版数据
export function updateForme(formeId: string, forme: AjaxRequest['addFormeForm']) {
    return request.put(HttpUrl.updateForme, { formeId, ...forme, creator: useUserStore().username, creatorId: useUserStore().id });
}

// 删除印版数据
export function deleteForme(formeId: string) {
    return request.del(HttpUrl.deleteForme, { params: { formeId } });
}

// 导入印版数据
export function importFormeList() {
    return request.post(HttpUrl.importFormeList, { creator: useUserStore().username, creatorId: useUserStore().id });
}
